<?php defined('SYSPATH') or die('No direct script access.');

abstract class Model_ProductParser_Abstract
{     
    /**
    * Защищенный конструктор - реализация Синглтон
    * 
    * @return Model_ProductParser_YML
    */
    protected function __construct()
    {
    }
    
    /**
    * Получить экземпляр класса - реализация Синглтон
    */
    public static function instance()
    {
        if (static::$_instance !== null) {
            return static::$_instance;
        }   
        
        static::$_instance = new static;
        return static::$_instance; 
    }
    
    public static function _get_source_code($url)
    {
        //return file_get_contents($url);
        
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
        curl_setopt($ch, CURLOPT_TIMEOUT, 20);
        curl_setopt($ch, CURLOPT_REFERER, 'http://www.google.com/');  
        curl_setopt($ch, CURLOPT_USERAGENT, 'User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0'); 
        curl_setopt($ch, CURLOPT_HEADER, true);
        curl_setopt($ch, CURLOPT_ENCODING, '');

        //curl_setopt($ch, CURLOPT_PROXY, '82.200.254.34:9090');
        $output = curl_exec($ch);
        curl_close($ch);
        
        /*if ($output) {
            list($header, $body) = explode("\r\n\r\n", $output);
            
            $headers = explode("\r\n", $header);
            $status  = explode(' ', $headers[0]);
            if ($status[1] == 301 || $status[1] == 302) {
                foreach ($headers as $item) {
                    if (strstr($item, 'Location:') !== false) {
                        $url = trim(str_replace('Location: ', '', $item));
                        return self::_get_source_code($url);
                    }
                }
            }

            return $body;  
        }  */  
        return $output;         
    }
    
    public static function _get_ebay_source_code($url)
    {        
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 20);
        curl_setopt($ch, CURLOPT_TIMEOUT, 20);
        curl_setopt($ch, CURLOPT_COOKIE, 'dp1=bidm/153b1ec4a^u1p/QEBfX0BAX19AQA**5592f2fc^bl/RUru-RU5774267c^pbf/#0000000000000100020000005774344c^cq/0^;Path=/;Domain=.ebay.com;Wed,expires=29 Jun 2018 20:49:16 GMT');
        curl_setopt($ch, CURLOPT_REFERER, 'http://www.google.com/');  
        curl_setopt($ch, CURLOPT_USERAGENT, 'User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041107 Firefox/1.0'); 
        curl_setopt($ch, CURLOPT_HEADER, true);
        curl_setopt($ch, CURLOPT_ENCODING, '');

        //curl_setopt($ch, CURLOPT_PROXY, '82.200.254.34:9090');
        $output = curl_exec($ch);
        curl_close($ch);
        
        return $output; 
    } 
    
    public static function _cut_str($start, $stop, &$str)
    {      
        $spos = strpos($str, $start);      //Поиск начала
        
        if ($spos === false) {
            return null;
        }
        
        $spos = $spos + strlen($start);     //Удлиняем позицию на длину строки, чтобы не включать ее в результат
        $text = substr($str, $spos);       //Режем строку от этой позиции
        $end_pos = strpos($text, $stop);   // Ищем конец в полученной строке
        
        if ($end_pos === false) {
            return null;
        }
        
        $text = substr($text, 0, $end_pos);    //Режем по конечной позиции     
        $str = str_replace($start . $text . $stop, '', $str);   // Удаляем найденное
        
        return trim($text);                                                                                                                                            
    }
    
    protected function _download_file($url, $filename)
    {
        file_put_contents($filename, fopen($url, 'r'));
    }
    
    // Wildberries
    protected function _get_4102_category($id)
    {
        $categories = array(
            1 => 1702,
            2 => 1848,
            3 => 312,
            7 => 1721,
            13 => 1734,
            14 => 1739,
            15 => 1741,
            16 => 1750,
            17 => 1773,
            18 => 1785,
            19 => 1753,
            20 => 1764,
            23 => 1796,
            24 => 1805,
            25 => 1716,
            26 => 1780,
            30 => 1877,
            31 => 1913,
            32 => 1882,
            33 => 1911,
            34 => 1917,
            38 => 1755,
            39 => 1754,
            44 => 1793,
            45 => 1793,
            48 => 1756,
            51 => 1889,
            52 => 1745,
            53 => 1824,
            55 => 1823,
            56 => 1796,
            59 => 1899,
            70 => 1857,
            89 => 1830,
            90 => 1834,
            92 => 1837,
            93 => 1917,
            102 => 1802,
            103 => 1884,
            113 => 1723,
            114 => 1704,
            115 => 1717,
            117 => 1719,
            118 => 1986,
            120 => 1883,
            128 => 1813,
            129 => 1811,
            133 => 1804,
            281 => 1775,
            282 => 1779,
            283 => 1776,
            286 => 1814,
            288 => 1796,
            301 => 1733,
            302 => 1731,
            303 => 1730,
            304 => 1736,
            307 => 1744,
            313 => 1827,
            314 => 1831,
            315 => 1835,
            318 => 1846,
            330 => 1739,
            332 => 1739,
            337 => 1818,
            338 => 1817,
            341 => 1819,
            346 => 1809,
            347 => 1777,
            351 => 1725,
            352 => 1843,
            367 => 1923,
            368 => 1937,
            369 => 1926,
            370 => 1921,
            371 => 1930,
            372 => 1934,
            415 => 380,
            457 => 1722,
            535 => 395,
            537 => 387,
            538 => 384,
            539 => 367,
            544 => 314,
            545 => 333,
            546 => 320,
            547 => 330,
            549 => 324,
            550 => 315,
            551 => 327,
            552 => 322,
            553 => 318,
            554 => 317,
            555 => 319,
            556 => 316,
            558 => 323,
            559 => 328,
            560 => 348,
            561 => 341,
            563 => 342,
            564 => 345,
            565 => 337,
            566 => 339,
            567 => 336,
            568 => 335,
            569 => 340,
            570 => 346,
            571 => 351,
            572 => 363,
            573 => 357,
            574 => 353,
            575 => 361,
            576 => 358,
            577 => 360,
            578 => 362,
            579 => 329,
            582 => 389,
            583 => 389,
            584 => 383,
            599 => 356,
            793 => 396,
            794 => 399,
            795 => 381,
            796 => 385,
            797 => 409,
            798 => 405,
            799 => 400,
            800 => 401,
            801 => 402,
            802 => 409,
            803 => 412,
            847 => 346,
            848 => 366,
            850 => 1729,
            851 => 1721,
            852 => 1721,
            853 => 1721,
            854 => 1721,
            855 => 1721,
            857 => 1721,
            858 => 1721,
            859 => 1721,
            863 => 375,
            864 => 376,
            865 => 377,
            866 => 379,
            870 => 1872,
            871 => 1922,
            872 => 1918,
            873 => 1902,
            874 => 1863,
            875 => 1865,
            876 => 1850,
            877 => 1873,
            878 => 1906,
            879 => 1904,
            880 => 1906,
            906 => 1859,
            907 => 1870,
            910 => 1869,
            911 => 1862,
            912 => 1903,
            913 => 1864,
            914 => 1861,
            915 => 1909,
            916 => 1908,
            939 => 1826,
            981 => 369,
            1100 => 1768,
            1101 => 1765,
            1102 => 1769,
            1103 => 1767,
            1104 => 1772,
            1171 => 1707,
            1174 => 1710,
            1175 => 1711,
            1177 => 1708,
            1178 => 1706,
            1179 => 1718,
            1180 => 1722,
            1181 => 1722,
            1182 => 1722,
            1183 => 1722,
            1184 => 1722,
            1185 => 1722,
            1187 => 1863,
            1188 => 1863,
            1189 => 1863,
            1190 => 1863,
            1192 => 1727,
            1193 => 1868,
            1213 => 1905,
            1218 => 1823,
            1242 => 1722,
            1249 => 1838,
            1250 => 1935,
            1252 => 1798,
            1253 => 1797,
            1254 => 1803,
            1294 => 1704,
            1296 => 369,
            1297 => 369,
            1298 => 369,
            1303 => 1786,
            1304 => 1787,
            1305 => 1788,
            1306 => 1789,
            1323 => 347,
            1327 => 1726,
            1328 => 1866,
            1360 => 1781,
            1362 => 1778,
            1365 => 1933,
            1366 => 1768,
            1369 => 1735,
            1370 => 2211,
            1371 => 2212,
            1373 => 1738,
            1374 => 1738,
            1375 => 378,
            1377 => 314,
            1378 => 380,
            1386 => 333,
            1395 => 1810,
            1419 => 360,
            1420 => 1844,
            1435 => 1833,
            1444 => 1881,
            1450 => 1766,
            1451 => 1802,
            1452 => 1802,
            1453 => 1802,
            1454 => 1802,
            1455 => 1802,
            1456 => 1802,
            1457 => 1802,
            1486 => 1760,
            1487 => 1800,
            1489 => 1750,
            1503 => 1830,
            1504 => 1830,
            1505 => 1842,
            1538 => 1901,
            1539 => 1900,
            1541 => 1812,
            1543 => 357,
            1544 => 357,
            1621 => 1801,
            1622 => 1919,
            1652 => 1748,
            1653 => 1749,
            1654 => 1746,
            1682 => 1867,
            1685 => 1888,
            1686 => 1880,
            1833 => 1924,
            1865 => 1892,
            1868 => 1935,
            1869 => 1935,
            1870 => 1935,
            1876 => 1813,
            1877 => 1813,
            1878 => 1813,
            1879 => 1813,
            1880 => 1813,
            1882 => 1813,
            1900 => 1758,
            1929 => 1805,
            1930 => 1805,
            1967 => 330,
            1968 => 320,
            1969 => 315,
            1970 => 325,
            1971 => 322,
            1972 => 327,
            1973 => 316,
            1974 => 323,
            1977 => 1845,
            1978 => 1845,
            1980 => 1832,
            1982 => 1827,
            1983 => 1827,
            1984 => 1827,
            1987 => 1827,
            2024 => 1771,
            2071 => 1845,
            2105 => 1760,
            2109 => 1712,
            2139 => 1853,
            2140 => 1854,
            2141 => 1855,
            2142 => 1856,
            2144 => 1851,
            2172 => 386,
            2173 => 403,
            2175 => 355,
            2273 => 1911,
            2274 => 1911,
            2275 => 1911,
            2276 => 1911,
            2281 => 334,
            2295 => 1828,
            2364 => 1927,
            2373 => 1838,
            2374 => 1838,
            2375 => 1838,
            2426 => 313,
            2440 => 1816,
            2468 => 1702,
            2469 => 1848,
            2470 => 1729,
            2471 => 1824,
            2472 => 1716,
            2473 => 1872,
            2474 => 1923,
            2475 => 1857,
            2479 => 1846,
            2480 => 1846,
            2482 => 1844,
            2497 => 1907,
            2592 => 1844,
            2593 => 1844,
            2594 => 1844,
            2595 => 1844,
            2596 => 1844,
            2597 => 1844,
            2598 => 1843,
            2599 => 1843,
            2600 => 1843,
            2601 => 1843,
            2602 => 1834,
            2603 => 1834,
            2604 => 1834,
            2605 => 1834,
            2606 => 1834,
            2607 => 1834,
            2608 => 1834,
            2610 => 1827,
            2611 => 1827,
            2612 => 1827,
            2613 => 1838,
            2614 => 1838,
            2615 => 1838,
            2616 => 1838,
            2617 => 1838,
            2618 => 1830,
            2619 => 1830,
            2620 => 1830,
            2621 => 1830,
            2622 => 1830,
            2623 => 1830,
            2624 => 1843,
            2632 => 1830,
            2634 => 1846,
            2635 => 1846,
            2638 => 1796,
            2639 => 1917,
            2700 => 1811,
            2701 => 1811,
            2709 => 1709,
            2724 => 1937,
            2725 => 1937,
            2726 => 1937,
            2727 => 1937,
            2737 => 341,
            2744 => 1935,
            2745 => 1935,
            2803 => 1883,
            2804 => 1883,
            2811 => 1852,
            2814 => 1705,
            2815 => 1714,
            2843 => 1832,
            2844 => 1832,
            2845 => 1832,
            2846 => 1837,
            2847 => 1837,
            2848 => 1837,
            2850 => 1934,
            2851 => 1934,
            2852 => 1934,
            2853 => 1934,
            2854 => 1926,
            2855 => 1926,
            2856 => 1926,
            2857 => 1926,
            2893 => 1796,
            2894 => 1823,
            2895 => 1823,
            2900 => 1929,
            2906 => 1841,
            2946 => 357,
            2948 => 365,
            2949 => 364,
            2997 => 1914,
            2998 => 1916,
            3000 => 1915,
            3011 => 1806,
            3013 => 1808,
            3014 => 1807,
            3659 => 1839,
            4045 => 312,
            4046 => 313,
            
            1180 => 1938,
            1181 => 1939,
            1182 => 1940,
            1183 => 1941,
            1184 => 1942,
            1185 => 1943,
            1242 => 1944,
            1187 => 1945,
            1188 => 1946,
            1189 => 1947,
            1190 => 1948,
            978 => 1950,
            
            1451 => 1951,
            1455 => 1952,
            1456 => 1953,
            1457 => 1954,
            1452 => 1955,
            1453 => 1956,
            1454 => 1957, 
            
            44 => 1958,
            45 => 1959,
            330 => 1960,
            332 => 1961,
            1487 => 1962,
            
            61 => 1963,
            62 => 1964,
            64 => 1965,
            65 => 1966,
            66 => 1967,
            79 => 1968,
            80 => 1969,
            81 => 1970,
            82 => 1971,
            83 => 1972,
            94 => 1973,
            96 => 1974,
            288 => 1975,
            1218 => 1976,
            1930 => 1977,
            
            112 => 1978,
            88 => 1979,
            1912 => 1980,
            1913 => 1981,
            1914 => 1982,
            1915 => 1983,
            1916 => 1984,
            1917 => 1985,
            
            2700 => 1987,
            2701 => 1988,
            
            131 => 1799,
            132 => 2404,
            
            139 => 1989,
            1421 => 1990,
            1422 => 1991,
            1423 => 1992,
            1424 => 1993,
            4324 => 1994,
            4325 => 1995,
            8210 => 1996,
            1425 => 1997,
            1426 => 1998,
            1427 => 1999,
            1428 => 2000,
            1429 => 2001,
            1430 => 2002,
            1431 => 2003,
            1929 => 2004,
            3608 => 2005,
            4261 => 2006,
            
            146 => 2007,
            890 => 2008,
            891 => 2009,
            892 => 2010,
            893 => 2011,
            894 => 2012,
            895 => 2013,
            896 => 2014,
            898 => 2015,
            899 => 2016,
            900 => 2017,
            901 => 2018,
            902 => 2019,
            903 => 2020,
            904 => 2021,
            905 => 2022,
            2511 => 2023,
            2912 => 2024,
            2913 => 2025,
            2914 => 2026,
            2994 => 2027,
            5149 => 2028,
            
            152 => 1949,
            151 => 2029,
            
            524 => 2030,
            206 => 2031,
            525 => 2032,
            531 => 2033,
            942 => 2034,
            943 => 2035,
            944 => 2036,
            945 => 2037,
            946 => 2038,
            947 => 2039,
            948 => 2040,
            949 => 2041,
            950 => 2042,
            291 => 2043,
            951 => 2044,
            952 => 2045,
            953 => 2046,
            954 => 2047,
            955 => 2048,
            956 => 2049,
            957 => 2050,
            958 => 2051,
            959 => 2052,
            2918 => 2053,
            529 => 2054,
            528 => 2055,
            960 => 2056,
            961 => 2057,
            962 => 2058,
            963 => 2059,
            964 => 2060,
            530 => 2061,
            826 => 2062,
            827 => 2063,
            828 => 2064,
            829 => 2065,
            830 => 2066,
            1202 => 2067,
            1203 => 2068,
            1267 => 2069,
            1268 => 2070,
            1418 => 2071,
            1571 => 2072,
            2489 => 2073,
            2842 => 2074,
            2950 => 2075,
            6212 => 2076,
            2316 => 2077,
            540 => 2078,
            541 => 2079,
            542 => 2080,
            
            317 => 1825,
            
            327 => 2081,
            328 => 2082,
            329 => 2083,
            
            340 => 2084,
            
            492 => 2085,
            991 => 2086,
            992 => 2087,
            994 => 2088,
            995 => 2089,
            996 => 2090,
            997 => 2091,
            993 => 2092,
            3036 => 2093,
            3037 => 2094,
            998 => 2095,
            999 => 2096,
            3038 => 2097,
            3039 => 2098,
            3040 => 2099,
            3041 => 2100,
            3042 => 2101,
            3043 => 2102,
            3044 => 2103,
            3045 => 2104,
            3046 => 2105,
            3047 => 2106,
            3048 => 2107,
            1000 => 2108,
            1001 => 2109,
            1002 => 2110,
            1003 => 2111,
            1004 => 2112,
            3025 => 2113,
            3026 => 2114,
            3027 => 2115,
            3028 => 2116,
            3029 => 2117,
            1005 => 2118,
            1006 => 2119,
            1007 => 2120,
            3030 => 2121,
            3031 => 2122,
            3032 => 2123,
            1008 => 2124,
            1009 => 2125,
            1010 => 2126,
            1011 => 2127,
            1012 => 2128,
            1057 => 2129,
            
            548 => 2130,
            
            557 => 2131,
            
            561 => 2132,
            2737 => 2133,
            
            562 => 2134,
            
            582 => 2135,
            
            802 => 2136,
            
            844 => 2137,
            
            845 => 2138,
            981 => 2139,
            982 => 2140,
            1296 => 2141,
            1297 => 2142,
            1298 => 2143,
            846 => 2144,
            979 => 2145,
            986 => 2146,
            1329 => 2147,
            1405 => 2148,
            
            851 => 2149,
            852 => 2150,
            853 => 2151,
            854 => 2152,
            855 => 2153,
            856 => 2154,
            857 => 2155,
            858 => 2156,
            859 => 2157,
            1212 => 2158,
            
            862 => 2159,
            
            1013 => 2160,
            1014 => 2161,
            1016 => 2162,
            1017 => 2163,
            1018 => 2164,
            1019 => 2165,
            1020 => 2166,
            1022 => 2167,
            1925 => 2168,
            1015 => 2169,
            1021 => 2170,
            1023 => 2171,
            1025 => 2172,
            1026 => 2173,
            1027 => 2174,
            1028 => 2175,
            
            1030 => 2176,
            1031 => 2177,
            1041 => 2178,
            1042 => 2179,
            1043 => 2180,
            1044 => 2181,
            1045 => 2182,
            1046 => 2183,
            1047 => 2184,
            1032 => 2185,
            1033 => 2186,
            1034 => 2187,
            1035 => 2188,
            1036 => 2189,
            1037 => 2190,
            1038 => 2191,
            1039 => 2192,
            1040 => 2193,
            
            1048 => 2194,
            1049 => 2195,
            1051 => 2196,
            1052 => 2197,
            1050 => 2198,
            1053 => 2199,
            1054 => 2200,
            1055 => 2201,
            
            1176 => 2202,
            2301 => 2203,
            2761 => 2204,
            2812 => 2205,
            2813 => 2206,
            1294 => 1715,
            
            1295 => 2207,
            
            1361 => 2208,
            
            1367 => 2209,
            1368 => 2210,
            
            1374 => 2213,
            
            1376 => 2214,
            1377 => 2215,
            1378 => 2216,
            1379 => 2217,
            1386 => 2218,
            1387 => 2219,
            2304 => 2220,
            
            1445 => 2221,
            
            1447 => 2222,
            1448 => 2223,
            
            1480 => 2224,
            1483 => 2225,
            1484 => 2226,
            1486 => 2227,
            1489 => 2228,
            
            1502 => 2229,
            
            1503 => 2230,
            1504 => 2231,
            1505 => 2232,
            2618 => 2233,
            2619 => 2234,
            2620 => 2235,
            2621 => 2236,
            2622 => 2237,
            2623 => 2238,
            2632 => 2239,
            
            1543 => 2240,
            1544 => 2241,
            2946 => 2242,
            
            1675 => 2243,
            
            1868 => 2244,
            1869 => 2245,
            1870 => 2246,
            2744 => 2247,
            2745 => 2248,
            
            1876 => 2249,
            1877 => 2250,
            1878 => 2251,
            1879 => 2252,
            1880 => 2253,
            1882 => 2254,
            
            1919 => 1724,
            
            1934 => 2255,
            1935 => 2256,
            1942 => 2257,
            1990 => 2258,
            2897 => 2259,
            1936 => 2260,
            1937 => 2261,
            1938 => 2262,
            1939 => 2263,
            2899 => 2264,
            
            1944 => 2265,
            1945 => 2266,
            1946 => 2267,
            1947 => 2268,
            1948 => 2269,
            1949 => 2270,
            1951 => 2271,
            1952 => 2272,
            1998 => 2273,
            2352 => 2274,
            2452 => 2275,
            
            1953 => 2276,
            1955 => 2277,
            1956 => 2278,
            1957 => 2279,
            1958 => 2280,
            1959 => 2281,
            1960 => 2282,
            1961 => 2283,
            1962 => 2284,
            1963 => 2285,
            1964 => 2286,
            1965 => 2287,
            1966 => 2288,
            1967 => 2289,
            1968 => 2290,
            1969 => 2291,
            1970 => 2292,
            1971 => 2293,
            1972 => 2294,
            1973 => 2295,
            1974 => 2296,
            
            1977 => 2297,
            1978 => 2298,
            2071 => 2299,
            
            1982 => 2300,
            1983 => 2301,
            1984 => 2302,
            1987 => 2303,
            2610 => 2304,
            2611 => 2305,
            2612 => 2306,
            
            1996 => 2307,
            1997 => 2308,
            
            2273 => 2309,
            2274 => 2310,
            2275 => 2311,
            2276 => 2312,
            
            2299 => 2313,
            
            2323 => 2314,
            2324 => 2315,
            2326 => 2316,
            2327 => 2317,
            2328 => 2318,
            2325 => 2319,
            2329 => 2320,
            2330 => 2321,
            2332 => 2322,
            2422 => 2323,
            2427 => 2324,
            
            2373 => 2325,
            2374 => 2326,
            2375 => 2327,
            2613 => 2328,
            2614 => 2329,
            2615 => 2330,
            2616 => 2331,
            2617 => 2332,
            
            2448 => 317,
            2449 => 336,
            2451 => 413,
            
            2479 => 2333,
            2480 => 2334,
            2634 => 2335,
            2635 => 2336,
            
            2482 => 2337,
            2592 => 2338,
            2593 => 2339,
            2594 => 2340,
            2595 => 2341,
            2596 => 2342,
            2597 => 2343,
            
            2598 => 2344,
            2599 => 2345,
            2600 => 2346,
            2601 => 2347,
            2624 => 2348,
            
            2602 => 2349,
            2603 => 2350,
            2604 => 2351,
            2605 => 2352,
            2606 => 2353,
            2607 => 2354,
            2608 => 2355,
            
            2724 => 2356,
            2725 => 2357,
            2726 => 2358,
            2727 => 2359,
            
            2736 => 2361,
            
            2760 => 2362,
            
            2803 => 2363,
            2804 => 2364,
            
            2843 => 2365,
            2844 => 2366,
            2845 => 2367,
            
            2846 => 2368,
            2847 => 2369,
            
            2850 => 2370,
            2851 => 2371,
            2852 => 2372,
            2853 => 2373,
            
            2854 => 2374,
            2855 => 2375,
            2856 => 2376,
            2857 => 2377,
            
            2895 => 2378,
            2896 => 2379,
            
            2907 => 2380,
            
            2951 => 2381,
            
            3012 => 2382,
            
            4263 => 2383,
            4264 => 2384,
            4266 => 2385,
            4279 => 2386,
            4280 => 2387,
            4281 => 2388,
            4282 => 2389,
            4284 => 2390,
            4285 => 2391,
            4314 => 2392,
            4267 => 2393,
            4286 => 2394,
            4287 => 2395,
            4288 => 2396,
            4290 => 2397,
            4268 => 2398,
            5685 => 2399,
            4265 => 2400,
            4269 => 2401,
            4302 => 2402,
            4271 => 2403,
        );
        
        if (isset($categories[$id])) {
            return $categories[$id];
        } else {
            // TODO log
            return 0;
        }
    }
    
    // Lamoda
    protected function _get_1001_category($id)
    {
        $categories = array(
            15 => 1824,
            17 => 1923,
            21 => 1830,
            23 => 1843,
            33 => 1827,
            37 => 1846,
            39 => 1845,
            41 => 1832,
            43 => 1837,
            47 => 1929,
            61 => 1935,
            89 => 1842,
            99 => 1839,
            129 => 1838,
            151 => 1937,
            157 => 1926,
            159 => 1934,
            167 => 1937,
            175 => 1843,
            201 => 374,
            203 => 380,
            205 => 399,
            209 => 1847,
            213 => 381,
            215 => 382,
            217 => 383,
            221 => 383,
            223 => 384,
            225 => 385,
            227 => 386,
            229 => 387,
            231 => 387,
            235 => 398,
            241 => 390,
            243 => 391,
            245 => 392,
            247 => 393,
            249 => 394,
            251 => 395,
            253 => 396,
            355 => 1729,
            357 => 1810,
            361 => 1811,
            365 => 1812,
            367 => 1750,
            369 => 1763,
            375 => 1734,
            395 => 1745,
            397 => 1785,
            407 => 1780,
            409 => 1777,
            415 => 1792,
            423 => 1753,
            427 => 1823,
            477 => 1872,
            479 => 1907,
            491 => 1908,
            493 => 1884,
            495 => 1892,
            513 => 1899,
            515 => 1883,
            517 => 1913,
            519 => 1873,
            521 => 1889,
            565 => 1704,
            567 => 1711,
            569 => 1706,
            571 => 1707,
            573 => 1710,
            593 => 1850,
            595 => 1854,
            597 => 1856,
            601 => 1853,
            647 => 1721,
            651 => 2152,
            657 => 2158,
            703 => 1862,
            713 => 1918,
            725 => 1916,
            775 => 2204,
            783 => 1726,
            785 => 1723,
            797 => 1866,
            799 => 1861,
            1588 => 313,
            1589 => 333,
            1590 => 314,
            1603 => 2134,
            1611 => 2133,
            1617 => 321,
            1619 => 2130,
            1621 => 357,
            1623 => 2280,
            1627 => 2137,
            1652 => 330,
            1661 => 322,
            1682 => 323,
            1690 => 2130,
            1693 => 357,
            1695 => 2280,
            1698 => 323,
            1700 => 329,
            1705 => 2137,
            1733 => 347,
            1736 => 1869,
            1856 => 323,
            1857 => 1724,
            1870 => 1978,
            2299 => 1914,
            2385 => 2119,
            2395 => 1719,
            2396 => 1864,
            2421 => 1983,
            2422 => 1980,
            2424 => 1981,
            2430 => 1833,
            2431 => 1840,
            2432 => 1841,
            2439 => 1835,
            2448 => 1844,
            2451 => 1931,
            2452 => 1936,
            2455 => 1933,
            2461 => 2249,
            2469 => 1772,
            2471 => 1744,
            2478 => 1738,
            2484 => 1743,
            2485 => 1781,
            2489 => 1755,
            2490 => 1754,
            2491 => 1756,
            2494 => 1955,
            2495 => 1951,
            2496 => 1956,
            2500 => 1806,
            2503 => 2309,
            2507 => 1892,
            2509 => 1881,
            2512 => 1876,
            2515 => 1880,
            2516 => 1879,
            2521 => 1875,
            2527 => 1920,
            2529 => 1921,
            2620 => 1928,
            2622 => 1829,
            2632 => 1790,
            2635 => 1901,
            2638 => 1915,
            2764 => 1834,
            2765 => 1902,
            2769 => 1903,
            2770 => 1905,
            2778 => 1800,
            2779 => 1708,
            2780 => 1714,
            2781 => 1709,
            2792 => 1863,
            2885 => 1855,
            2954 => 1792,
            2964 => 1836,
            2969 => 1828,
            2970 => 1832,
            2979 => 1926,
            2992 => 1740,
            2993 => 1739,
            2999 => 2228,
            3000 => 1761,
            3001 => 1762,
            3002 => 1817,
            3004 => 2378,
            3005 => 2379,
            3007 => 1803,
            3009 => 1807,
            3010 => 1804,
            3011 => 1801,
            3012 => 1738,
            3014 => 1773,
            3015 => 1781,
            3019 => 363,
            3020 => 357,
            3023 => 377,
            3028 => 363,
            3029 => 357,
            3032 => 377,
            3036 => 2229,
            3038 => 1878,
            3042 => 1890,
            3044 => 1884,
            3045 => 1892,
            3050 => 340,
            3060 => 316,
            3062 => 2130,
            3063 => 340,
            3066 => 340,
            3070 => 2134,
            3071 => 2280,
            3076 => 340,
            3093 => 2154,
            3101 => 1777,
            3103 => 1985,
            3109 => 1985,
            3113 => 1723,
            3115 => 2157,
            3120 => 1867,
            3133 => 1859,
            3136 => 1862,
            3151 => 1861,
            3195 => 1745,
            3197 => 1744,
            3210 => 1881,
            3223 => 1921,
            1598 => 2134,
            3209 => 1801,
            3218 => 2380,
            3259 => 1826,

            35 => 1835,
            53 => 1933,
            59 => 1930,
            131 => 1925,
            177 => 1929,
            197 => 1928,
            207 => 1829,
            379 => 1730,
            425 => 1823,
            485 => 1911,
            487 => 1909,
            505 => 1888,
            523 => 1986,
            563 => 1704,
            591 => 1850,
            653 => 2153,
            687 => 1725,
            689 => 1859,
            701 => 1717,
            729 => 1909,
            743 => 1799,
            781 => 2362,
            795 => 1865,
            817 => 1863,
            1626 => 359,
            1704 => 359,
            2420 => 1982,
            2436 => 1827,
            2445 => 1845,
            2458 => 1930,
            2459 => 1930,
            2464 => 1745,
            2475 => 1736,
            2476 => 1736,
            2504 => 1911,
            2505 => 1911,
            2506 => 1882,
            2508 => 1881,
            2513 => 1877,
            2514 => 1877,
            2518 => 1883,
            2520 => 1873,
            2523 => 1873,
            2528 => 1873,
            2542 => 1843,
            2617 => 1832,
            2618 => 1832,
            2619 => 1832,
            2631 => 1785,
            2637 => 1899,
            2767 => 1906,
            2768 => 1904,
            2783 => 1717,
            2784 => 1717,
            2787 => 1722,
            2788 => 1957,
            2947 => 1823,
            2949 => 1733,
            2976 => 1929,
            2977 => 1937,
            2995 => 1743,
            3016 => 1956,
            3047 => 1921,
            3079 => 1719,
            3081 => 1704,
            3082 => 1704,
            3088 => 1711,
            3089 => 1711,
            3096 => 1718,
            3100 => 1957,
            3114 => 1980,
            3118 => 1864,
            3121 => 1850,
            3126 => 1854,
            3127 => 1854,
            3128 => 1854,
            3141 => 1857,
            3149 => 1864,
            3152 => 1870,
            3211 => 1913,
            3207 => 2213,
            3201 => 1736,

            79 => 2405,
            91 => 1826,
            93 => 2406,
            103 => 2407,
            127 => 1831,
            133 => 2408,
            137 => 2409,
            163 => 2410,
            171 => 2411,
            177 => 2412,
            179 => 2413,
            211 => 2414,
            219    => 2415,
            233 => 388,
            237 => 389,
            239 => 389,
            255 => 400,
            257 => 2416,
            259 => 400,
            261 => 401,
            263 => 402,
            265 => 403,
            267 => 404,
            269 => 405,
            271 => 405,
            273 => 406,
            275 => 408,
            277 => 409,
            279 => 409,
            281 => 410,
            283 => 411,
            285 => 412,
            287 => 413,
            289 => 414,
            313 => 358,
            315 => 358,
            317 => 358,
            319 => 358,
            323 => 358,
            325 => 358,
            327 => 358,
            359 => 2253,
            363 => 1814,
            371 => 1731,
            373 => 2209,
            377 => 1731,
            399 => 1741,
            401 => 1773,
            403 => 1775,
            405 => 1774,
            411 => 2208,
            429 => 1823,
            485 => 2417,
            489 => 2418,
            497 => 1888,
            501 => 1888,
            503 => 1888,
            549 => 405,
            553 => 358,
            557 => 1716,
            559 => 1857,
            575 => 1712,
            577 => 2419,
            603 => 1852,
            605 => 2420,
            613 => 2421,
            619 => 2144,
            621 => 2144,
            623 => 2144,
            625 => 2144,
            627 => 2144,
            629 => 2144,
            631 => 2144,
            633 => 2144,
            635 => 2144,
            637 => 2144,
            639 => 2144,
            641 => 2144,
            643 => 2144,
            645 => 2144,
            649 => 2151,
            655 => 2150,
            671 => 2138,
            673 => 2140,
            675 => 2140,
            677 => 2143,
            679 => 2138,
            681 => 2142,
            683 => 1725,
            685 => 1725,
            695 => 2146,
            697 => 2146,
            699 => 2146,
            705 => 1950,
            709 => 1805,
            737 => 1798,
            761 => 1806,
            739 => 1797,
            759 => 1986,
            793 => 1865,
            815 => 1722,
            819 => 1950,
            831 => 2031,
            832 => 204,
            1591 => 348,
            1592 => 348,
            1593 => 348,
            1594 => 348,
            1596 => 348,
            1597 => 348,
            1599 => 342,
            1600 => 337,
            1601 => 337,
            1602 => 337,
            1604 => 336,
            1605 => 336,
            1606 => 335,
            1607 => 335,
            1608 => 335,
            1609 => 338,
            1610 => 2133,
            1615 => 342,
            1617 => 339,
            1618 => 341,
            1619 => 2132,
            1620 => 2132,
            1621 => 342,
            1622 => 341,
            1624 => 2280,
            1625 => 344,
            1626 => 346,
            1627 => 373,
            1628 => 346,
            1629 => 345,
            1630 => 335,
            1631 => 345,
            1632 => 345,
            1634 => 346,
            1635 => 346,
            1636 => 346,
            1653 => 330,
            1655 => 330,
            1656 => 330,
            1657 => 330,
            1658 => 315,
            1660 => 324,
            1662 => 322,
            1663 => 322,
            1664 => 322,
            1665 => 318,
            1666 => 318,
            1667 => 318,
            1668 => 318,
            1669 => 317,
            1670 => 318,
            1671 => 317,
            1672 => 316,
            1673 => 316,
            1674 => 316,
            1675 => 319,
            1676 => 2360,
            1677 => 2361,
            1683 => 324,
            1684 => 2131,
            1685 => 320,
            1686 => 320,
            1688 => 320,
            1689 => 2130,
            1691 => 326,
            1692 => 2131,
            1693 => 324,
            1694 => 2131,
            1695 => 324,
            1697 => 326,
            1699 => 329,
            1700 => 329,
            1704 => 328,
            1705 => 328,
            1706 => 328,
            1710 => 327,
            1712 => 328,
            1713 => 328,
            1734 => 347,
            1735 => 1869,
            1736 => 1869,
            1858 => 1724,
            1859 => 1724,
            1868 => 395,
            1872 => 346,
            1873 => 328,
            2423 => 1984,
            2428 => 1833,
            2429 => 1833,
            2434 => 2301,
            2435 => 2302,
            2437 => 2301,
            2438 => 2300,
            2440 => 1835,
            2441 => 1835,
            2443 => 2297,
            2444 => 2299,
            2446 => 2297,
            2450 => 1931,
            2456 => 1933,
            2457 => 1933,
            2462 => 2250,
            2463 => 2251,
            2465 => 1765,
            2466 => 1767,
            2467 => 1768,
            2468 => 1768,
            2470 => 1769,
            2474 => 1736,
            2477 => 1736,
            2479 => 1738,
            2480 => 1738,
            2483 => 1742,
            2497 => 1805,
            2498 => 1808,
            2501 => 1738,
            2502 => 1773,
            2510 => 1881,
            2511 => 1881,
            2517 => 2364,
            2518 => 2363,
            2519 => 1883,
            2526 => 1917,
            2528 => 1918,
            2530 => 1986,
            2613 => 1831,
            2614 => 1831,
            2615 => 2366,
            2616 => 2365,
            2617 => 2365,
            2625 => 1764,
            2626 => 1764,
            2627 => 1739,
            2628 => 1787,
            2629 => 1786,
            2630 => 1788,
            2636 => 1900,
            2639 => 1794,
            2640 => 1764,
            2766 => 1906,
            2772 => 1773,
            2774 => 1778,
            2775 => 1779,
            2777 => 1805,
            2782 => 1715,
            2786 => 1722,
            2937 => 1963,
            2938 => 1974,
            2939 => 1968,
            2940 => 1968,
            2941 => 1964,
            2942 => 1966,
            2943 => 1966,
            2944 => 1966,
            2945 => 1970,
            2947 => 1976,
            2948 => 1975,
            2949 => 1967,
            2950 => 1967,
            2951 => 1967,
            2952 => 1969,
            2953 => 1977,
            2955 => 2231,
            2956 => 2230,
            2957 => 2239,
            2962 => 1836,
            2967 => 1827,
            2968 => 1837,
            2971 => 1844,
            2972 => 2343,
            2973 => 2337,
            2974 => 2409,
            2975 => 2409,
            2976 => 1931,
            2977 => 1931,
            2980 => 1926,
            2981 => 1934,
            2986 => 385,
            2988 => 402,
            2989 => 409,
            2994 => 1793,
            2996 => 1782,
            2997 => 1783,
            2998 => 2036,
            2999 => 1750,
            3039 => 1879,
            3040 => 2048,
            3041 => 1873,
            3043 => 1884,
            3087 => 1711,
            3099 => 1802,
            3196 => 1764,
            3199 => 316,
            3202 => 1773,
            3215 => 335,
            3213 => 316,
        );
        
        if (isset($categories[$id])) {
            return $categories[$id];
        } else {
            return 0;
        }
    }
    
    // Yoox
    protected function _get_5057_category($id)
    {
        $categories = array(
            3400000 => 1764,
            3600000 => 1773,
            3700000 => 1739,
            4500000 => 1704,
            4700000 => 1817,
            4400000 => 1824,
            141 => 1766,
            411 => 1764,
            140 => 1771,
            27863 => 1764,
            176 => 322,
            68 => 1776,        // есть мужские
            358 => 1774,       // есть мужские
            70 => 1782,        
            71 => 1781,        // есть мужские
            177 => 1775,
            25234 => 1773,
            720 => 1777,
            79 => 1739,
            340 => 1738,       // есть мужские
            338 => 1738,       // есть мужские
            339 => 1738,       // есть мужские
            3422 => 1739,
            78 => 2213,        // есть мужские
            77 => 1738,        // есть мужские
            296 => 2209,
            3418 => 1783,      // есть мужские
            95 => 1758,
            3419 => 1783,
            96 => 1785,        // есть мужские
            94 => 1743,        // есть мужские
            29225 => 1780,
            345 => 1714,
            346 => 1714,
            342 => 1708,
            343 => 1708,
            112 => 1707,
            236 => 2203,
            347 => 1714,
            110 => 1711,       // есть мужские и детские
            344 => 1708,
            111 => 1704,       // есть мужские
            25266 => 2203,
            25267 => 1705,
            246 => 1817,
            192 => 1817,
            129 => 1817,       // есть мужские
            128 => 1818,
            8948 => 1817,
            127 => 1820,
            130 => 2379,
            224 => 2084,
            147 => 1834,
            3410 => 2344,
            215 => 1835,
            107 => 1838,
            407 => 1846,
            397 => 2297,
            3412 => 2326,
            160 => 1847,
            216 => 1827,
            199 => 1845,
            3407 => 1827,
            3413 => 2325,
            3414 => 2230,
            3406 => 1825,
            3411 => 1845,
            8256 => 1846,
            3408 => 1827,
            3405 => 1843,
            105 => 1830,
            106 => 1831,
            159 => 1832,
            25255 => 2325,
            25254 => 2326,
            421 => 1847,
        );
        
        if (isset($categories[$id])) {
            return $categories[$id];
        } else {
            // TODO log
            return 0;
        }
    }
    
    // Showrooms
    protected function _get_3761_category($id)
    {
        $categories = array(
            1000001 => 1729,
            85151 => 1811,
            85153 => 1814,
            85166 => 1796,
            85171 => 1799,
            85194 => 1844,
            85197 => 1843,
            85357 => 1824,
            85362 => 1718,
            85363 => 1726,
            85364 => 1717,
            85370 => 1827,
            85372 => 1829,
            85375 => 1753,
            85376 => 1781,
            85378 => 1780,
            85379 => 1799,
            85382 => 1720,
            85384 => 1980,
            85385 => 1983,
            85386 => 1981,
            85387 => 1982,
            85391 => 1723,
            85392 => 1816,
            85397 => 1846,
            85399 => 2209,
            85401 => 1985,
            85403 => 1835,
            85405 => 1711,
            85406 => 1707,
            85408 => 2419,
            1000000 => 1872,
            '85151000000' => 1909,
            '85153000000' => 2418,
            '85167000000' => 1921,
            '85170000000' => 1918,
            '85275000000' => 1930,
            '85357000000' => 1923,
            '85360000000' => 1857,
            '85363000000' => 1866,
            '85364000000' => 1862,
            '85366000000' => 1863,
            '85367000000' => 1859,
            '85370000000' => 1926,
            '85372000000' => 1928,
            '85373000000' => 1883,
            '85374000000' => 1877,
            '85382000000' => 1858,
            '85384000000' => 1870,
            '85390000000' => 1867,
            '85391000000' => 1861,
            '85392000000' => 1910,
            '85402000000' => 1857,
            '85403000000' => 1933,
            '85405000000' => 1854,

            85115 => 1764,
            85152 => 1813,
            85167 => 1802,
            85169 => 1798,
            85170 => 1797,
            85172 => 1808,
            85192 => 1845,
            85196 => 1830,
            85228 => 1799,
            85275 => 1831,
            85276 => 1719,
            85354 => 1729,
            85356 => 1773,
            85358 => 85358,
            85359 => 1731,
            85360 => 1716,
            85361 => 1704,
            85365 => 1721,
            85366 => 1722,
            85367 => 1725,
            85369 => 1833,
            85371 => 1837,
            85373 => 1741,
            85374 => 1737,
            85377 => 1745,
            85380 => 1802,
            85381 => 1823,
            85382 => 1720,
            85383 => 1984,
            85388 => 1720,
            85389 => 1720,
            85390 => 1720,
            85394 => 1760,
            85396 => 1796,
            85398 => 1800,
            85402 => 1716,
            85404 => 1775,
            85407 => 1706,
            85409 => 1834,
            '85152000000' => 1911,
            '85166000000' => 1917,
            '85196000000' => 1929,
            '85197000000' => 1937,
            '85228000000' => 1879,
            '85276000000' => 1864,
            '85354000000' => 1872,
            '85356000000' => 1899,
            '85358000000' => 1884,
            '85359000000' => 1888,
            '85361000000' => 1850,
            '85362000000' => 1865,
            '85365000000' => 1903,
            '85368000000' => 1869,
            '85369000000' => 1931,
            '85371000000' => 1934,
            '85376000000' => 1873,
            '85377000000' => 1892,
            '85394000000' => 1891,
            '85396000000' => 1917,
            '85407000000' => 1856,
            '85408000000' => 2420,
        );
        
        if (isset($categories[$id])) {
            return $categories[$id];
        } else {
            return 0;
        }
    }
    
    // Halens
    protected function _get_743_category($id)
    {
        $categories = array(
            1000000 => 1729,
            1001000 => 1785,
            1001041 => 1787,
            1001044 => 1788,
            1002000 => 1764,
            1003000 => 1796,
            1003019 => 1804,
            1004000 => 1777,
            1005050 => 1730,
            1005051 => 1731,
            1005052 => 1731,
            1005053 => 1734,
            1006000 => 1753,
            1007033 => 1742,
            1007034 => 1743,
            1008000 => 1744,
            1009035 => 1773,
            1009037 => 1781,
            1010064 => 1739,
            1010065 => 1738,
            1010066 => 1740,
            1012000 => 1716,
            1012030 => 1725,
            1012031 => 1717,
            1013000 => 1810,
            1013039 => 1811,
            1013040 => 1815,
            1014000 => 1745,
            1048000 => 1791,
            1049000 => 1805,
            1049055 => 1806,
            1049057 => 1739,
            1050011 => 1823,
            1050046 => 2379,
            1050047 => 1819,
            1061048 => 1795,
            1061049 => 1752,
            2000000 => 1872,
            2016000 => 1877,
            2017000 => 1857,
            2018000 => 1883,
            2019000 => 1899,
            2023000 => 1907,
            2053000 => 1986,
            3000000 => 313,
            3028000 => 323,
            3029000 => 322,
            3030000 => 330,
            3036000 => 2137,
            3073000 => 329,
            4038000 => 1824,
            4038014 => 1844,
            4038015 => 1843,
            4038017 => 1830,
            4038018 => 1827,
            4038020 => 1845,
            4038070 => 1828,
            1001042 => 1786,
            1001043 => 1788,
            1002058 => 1771,
            1002059 => 1766,
            1003002 => 1802,
            1003003 => 1797,
            1003004 => 1798,
            1003021 => 1798,
            1003022 => 1798,
            1003023 => 1798,
            1003024 => 1798,
            1003025 => 1798,
            1003026 => 1797,
            1003027 => 1797,
            1003027 => 1797,
            1003028 => 1797,
            1005000 => 1730,
            1006067 => 1756,
            1006068 => 1755,
            1007000 => 1742,
            1009000 => 1773,
            1009036 => 1773,
            1010000 => 1737,
            1012029 => 1721,
            1013038 => 1795,
            1048060 => 1773,
            1048061 => 1737,
            1048062 => 1750,
            1049054 => 1805,
            1049056 => 1807,
            1050000 => 1817,
            1050010 => 1817,
            1061000 => 1750,
            2015000 => 1882,
            2020000 => 1917,
            2022000 => 1873,
        );
        
        if (isset($categories[$id])) {
            return $categories[$id];
        } else {
            return 0;
        }
    }
    
    // Stylepit
    protected function _get_5533_category($id)
    {
        $categories = array(
            4016 => 1872,
            4017 => 1873,
            4024 => 1918,
            4028 => 1911,
            4029 => 2311,
            4030 => 1884,
            4031 => 1909,
            4032 => 1911,
            4033 => 2309,
            4037 => 1883,
            4040 => 1881,
            4041 => 1881,
            4042 => 1881,
            4043 => 1882,
            4045 => 2312,
            4046 => 1892,
            4047 => 1881,
            4048 => 1877,
            4049 => 1877,
            4050 => 1877,
            4051 => 1877,
            4052 => 1877,
            4054 => 1879,
            4055 => 1877,
            4056 => 1877,
            4057 => 1877,
            4058 => 1877,
            4060 => 1899,
            4062 => 1914,
            4063 => 1913,
            4064 => 1923,
            4065 => 1937,
            4066 => 1923,
            4067 => 1930,
            4068 => 1933,
            4069 => 1934,
            4071 => 1850,
            4072 => 1862,
            4073 => 1904,
            4075 => 1865,
            4076 => 1863,
            4080 => 1869,
            4081 => 1859,
            4082 => 1921,
            4083 => 1864,
            4084 => 1861,
            4085 => 1868,
            5356 => 1906,
            5357 => 1904,
            8225 => 1865,
            8226 => 1903,
            9377 => 1856,
            11726 => 1890,
            11730 => 1865,
            11731 => 1853,
            11733 => 1854,
            11735 => 1850,
            11738 => 1851,
            11742 => 1856,
            11743 => 1857,
            11748 => 1870,
            12395 => 1904,
            12396 => 1906,
            12397 => 1903,
            12399 => 1859,
            12400 => 1859,
            4098 => 1729,
            4099 => 1764,
            4100 => 1744,
            4101 => 1795,
            4102 => 1752,
            4103 => 1785,
            4104 => 1773,
            4105 => 1730,
            4106 => 1753,
            4108 => 1742,
            4109 => 1739,
            4110 => 1738,
            4114 => 2209,
            4115 => 1743,
            4116 => 1745,
            4118 => 1781,
            4119 => 1780,
            4120 => 1777,
            4121 => 1951,
            4122 => 1796,
            4124 => 1823,
            4125 => 1824,
            4126 => 1827,
            4127 => 1843,
            4128 => 1833,
            4129 => 1845,
            4130 => 1837,
            4131 => 1846,
            4133 => 1704,
            4134 => 1725,
            4135 => 1723,
            4136 => 1978,
            4137 => 1724,
            4140 => 1717,
            4141 => 1718,
            4142 => 1719,
            4143 => 1721,
            4149 => 1719,
            8819 => 1797,
            8822 => 1797,
            8823 => 1797,
            9360 => 1833,
            9373 => 2152,
            10787 => 1796,
            11094 => 1706,
            11098 => 1710,
            11099 => 1711,
            11102 => 2203,
            11114 => 1982,
            11115 => 1980,
            11116 => 1981,
            12372 => 1956,
            12373 => 1830,
            12375 => 1844,
            12378 => 1827,
            12379 => 1827,
            12381 => 1827,
            12382 => 1845,
            12383 => 1845,
            12385 => 1845,
            31663 => 2254,
            31664 => 2249,
            31665 => 2250,
            31666 => 2251,
            31680 => 1752,
            31688 => 1745,
            31689 => 1785,
            31690 => 1785,
            32460 => 1777,
            32487 => 1740,
            32488 => 1738,
            32489 => 1777,
            32512 => 1704,
            32513 => 1704,
            37102 => 1813,
            37103 => 1753,
            37565 => 1773,
            37566 => 1773,
            37577 => 1785,
            37579 => 1781,
            37580 => 1777,
            8408 => 313,
            8676 => 2121,
            10161 => 1993,
            10162 => 2002,
            10163 => 1785,
            10262 => 2002,
            10263 => 1993,
            10265 => 1993,
            10267 => 2002,
            10268 => 1742,
            3961 => 374,
            3973 => 313,

            4018 => 1873,
            4019 => 1917,
            4020 => 1917,
            4021 => 1917,
            4022 => 1917,
            4023 => 1986,
            4025 => 1917,
            4026 => 1917,
            4027 => 1917,
            4034 => 1889,
            4035 => 1911,
            4036 => 1897,
            4038 => 2363,
            4039 => 2364,
            4044 => 1888,
            4053 => 1880,
            4059 => 1899,
            4061 => 1873,
            4070 => 1857,
            4074 => 1865,
            9375 => 1914,
            11735 => 1852,
            12398 => 1904,
            12401 => 1859,
            4107 => 1733,
            4112 => 1738,
            4113 => 1736,
            4117 => 1775,
            4123 => 1807,
            4138 => 1724,
            4145 => 1722,
            4146 => 1722,
            4147 => 1944,
            8814 => 1798,
            8815 => 1798,
            8816 => 1798,
            8817 => 1798,
            8818 => 1798,
            8820 => 1797,
            8821 => 1797,
            8824 => 1800,
            8825 => 1807,
            9364 => 2150,
            9369 => 1721,
            11096 => 1718,
            11100 => 1712,
            12376 => 2301,
            12377 => 2302,
            12384 => 1845,
            31661 => 1771,
            31662 => 1766,
            31691 => 1783,
            31692 => 1773,
            31693 => 1773,
            32293 => 2208,
            32461 => 1775,
            32495 => 2299,
            37562 => 1773,
            37575 => 2208,
            37578 => 1775,
            8726 => 1990,
            8727 => 2002,
            8730 => 2000,
            8731 => 2000,
            8732 => 2002,
            8733 => 1998,
            8734 => 1993,
            8735 => 1999,
            8737 => 1992,
            10158 => 1991,
            10159 => 1999,
            10160 => 1998,
            10163 => 1990,
            10261 => 1990,
            10266 => 2000,
            10268 => 1991,
            10269 => 1992,
            10879 => 1997,
            32539 => 2000,
            32540 => 1991,
            32541 => 1998,
        );
        
        if (isset($categories[$id])) {
            return $categories[$id];
        } else {
            return 0;
        }
    }
    
    // ASOS
    protected function _get_4965_category($id)
    {
        $categories = array(
            4 => 1764,
            43 => 1811,
            44 => 1785,
            46 => 1785,
            50 => 1739,
            55 => 1773,
            64 => 1720,
            66 => 1998,
            68 => 1719,
            73 => 1785,
            74 => 1990,
            75 => 1817,
            79 => 1739,
            86 => 1802,
            87 => 1802,
            103 => 1917,
            125 => 1780,
            141 => 1824,
            142 => 1739,
            150 => 1764,
            151 => 1764,
            166 => 1780,
            200 => 1731,
            236 => 1796,
            245 => 1811,
            290 => 1883,
            320 => 2227,
            323 => 1802,
            324 => 1781,
            325 => 1753,
            326 => 1773,
            329 => 1781,
            330 => 1785,
            333 => 1813,
            334 => 1813,
            336 => 1716,
            338 => 1764,
            345 => 2000,
            353 => 1990,
            359 => 2002,
            360 => 1731,
            362 => 1993,
            364 => 1739,
            366 => 2000,
            368 => 2004,
            372 => 1739,
            373 => 1773,
            376 => 1813,
            380 => 1796,
            387 => 1899,
            414 => 0,
            421 => 1902,
            432 => 0,
            433 => 0,
            435 => 0,
            443 => 0,
            444 => 0,
            454 => 0,
            455 => 1817,
            459 => 1870,
            463 => 0,
            471 => 1882,
            494 => 1889,
            499 => 1888,
            500 => 0,
            515 => 1923,
            522 => 1865,
            547 => 1764,
            551 => 1753,
            563 => 1780,
            569 => 1718,
            571 => 1723,
            572 => 1869,
            579 => 1859,
            581 => 0,
            585 => 1736,
            589 => 0,
            593 => 1739,
            597 => 0,
            602 => 1817,
            603 => 1753,
            642 => 1999,
            645 => 1781,
            658 => 1736,
            667 => 1739,
            696 => 1780,
            699 => 1764,
            703 => 1884,
            704 => 0,
            709 => 0,
            712 => 1992,
            714 => 1781,
            725 => 1731,
            751 => 1993,
            752 => 1716,
            758 => 1813,
            760 => 1773,
            768 => 1719,
            774 => 1892,
            777 => 1780,
            780 => 0,
            784 => 0,
            796 => 1773,
            805 => 1764,
            808 => 1753,
            810 => 1813,
            812 => 1739,
            814 => 1720,
            819 => 1731,
            821 => 1739,
            833 => 1785,
            835 => 1736,
            837 => 1999,
            850 => 1750,
            852 => 1773,
            854 => 1780,
            858 => 1719,
            881 => 1781,
            883 => 1716,
            887 => 1718,
            890 => 1802,
            894 => 1720,
            905 => 1824,
            914 => 1739,
            916 => 1719,
            919 => 1997,
            932 => 1796,
            934 => 1716,
            936 => 1785,
            937 => 1704,
            939 => 1753,
            942 => 1736,
            943 => 1817,
            962 => 1739,
            963 => 1720,
            964 => 0,
            987 => 2002,
            1066 => 1911,
            1130 => 1883,
            1370 => 1739,
            1631 => 1861,
            2572 => 1796,
            2703 => 1857,
            2813 => 1921,
            3274 => 1811,
            3308 => 0,
            3313 => 1981,
            3322 => 1811,
            3328 => 1721,
            3331 => 1722,
            3335 => 1723,
            3337 => 1717,
            3343 => 1724,
            3347 => 1720,
            3349 => 1718,
            3354 => 1711,
            3391 => 1707,
            3393 => 1980,
            3395 => 1739,
            3445 => 0,
            3448 => 1787,
            3459 => 1785,
            3460 => 1901,
            3470 => 0,
            3472 => 1755,
            3487 => 1777,
            3546 => 1731,
            3570 => 1788,
            3574 => 1899,
            3577 => 1730,
            3582 => 1805,
            3590 => 1736,
            3593 => 1899,
            3594 => 1787,
            3615 => 1756,
            3639 => 1813,
            3643 => 1753,
            3670 => 1755,
            3676 => 1773,
            3684 => 0,
            3691 => 1803,
            3694 => 1780,
            3717 => 1804,
            3724 => 1798,
            3744 => 1754,
            3746 => 1982,
            3756 => 0,
            3799 => 2249,
            3805 => 1745,
            3829 => 1736,
            3838 => 1731,
            3872 => 1776,
            3884 => 1797,
            3889 => 1813,
            4014 => 0,
            4034 => 1785,
            4060 => 1786,
            4061 => 1900,
            4062 => 1813,
            4127 => 1741,
            4129 => 1799,
            4135 => 1753,
            4147 => 1773,
            4153 => 1779,
            4157 => 1773,
            4162 => 1779,
            4181 => 0,
            4192 => 0,
            4201 => 0,
            4261 => 1753,
            4328 => 1800,
            4342 => 1773,
            4356 => 0,
            4623 => 1736,
            4690 => 1741,
            4757 => 1799,
            4805 => 1823,
            4817 => 1740,
            4825 => 0,
            4836 => 1818,
            4862 => 2297,
            4882 => 1830,
            4888 => 2300,
            4889 => 2301,
            4890 => 1837,
            4893 => 1844,
            5045 => 1831,
            5046 => 1823,
            5048 => 0,
            5052 => 1825,
            5144 => 0,
            5173 => 0,
            5189 => 1926,
            5483 => 1785,
            5484 => 1899,
            5487 => 1901,
            5508 => 1904,
            5550 => 0,
            5569 => 1917,
            5576 => 1917,
            6082 => 0,
            6124 => 1854,
            6133 => 0,
            6146 => 0,
            6227 => 0,
            6554 => 1861,
            6556 => 1861,
            6561 => 1861,
            6589 => 1861,
            6593 => 1861,
            6595 => 1861,
            6604 => 1861,
            6606 => 1861,
            6618 => 1861,
            6620 => 1861,
            6624 => 1861,
            6698 => 1883,
            6747 => 1877,
            6755 => 1935,
            6803 => 1929,
            6809 => 1933,
            6863 => 1934,
            6869 => 1924,
            6872 => 1930,
            6875 => 1933,
            7139 => 0,
            7143 => 1918,
            7144 => 0,
            7206 => 1873,
            7239 => 1873,
            7242 => 1873,
            7244 => 1873,
            7245 => 1873,
            7247 => 1873,
            7250 => 1873,
            7279 => 0,
            7405 => 2309,
            7527 => 1884,
            7529 => 1911,
            7530 => 0,
            7533 => 1911,
            7535 => 1911,
            7537 => 1892,
            7538 => 1883,
            7543 => 1909,
            7545 => 0,
            7564 => 0,
            8205 => 1764,
            8214 => 2226,
            8246 => 1767,
            8305 => 0,
            8449 => 0,
            9345 => 1873,
            12036 => 0,
            12037 => 0,
            12277 => 1888,
            12485 => 1877,
            12493 => 1877,
            13439 => 1888,
            15472 => 1720,
            16396 => 1739,
            16401 => 1764,
            16404 => 1781,
            16414 => 1753,
            16422 => 1773,
            16427 => 1780,
            16472 => 1720,
            16532 => 0,
            16620 => 0,
            17791 => 1880,
            17799 => 0,
            17964 => 0,
            17968 => 0,
            17970 => 0,
            17971 => 0,
            17972 => 0,
            17976 => 0,
            17984 => 0,
            17985 => 0,
            17986 => 0,
            17988 => 0,
            17991 => 0,
            17994 => 0,
            17997 => 0,
            18008 => 0,
            18361 => 0,
            18845 => 1864,
            18861 => 0,
            18864 => 0,
            19361 => 1914,
            20962 => 1720,
            21629 => 1873,
            21676 => 1873,
            21736 => 1873,
            21772 => 1873,
            21849 => 1873,
            21987 => 1920,
            22658 => 1871,
            23620 => 1743,
            25402 => 0,
            25983 => 1861,
            25999 => 1861,
            27416 => 0,
            30088 => 1877,
            30538 => 0,
            30661 => 0,
            30664 => 0,
            31265 => 0,
            32817 => 0,
            32818 => 0,
            32820 => 0,
            32944 => 0,
            32945 => 0,
            32947 => 0,
            33069 => 0,
            33070 => 0,
            33071 => 0,
            33072 => 0,
            33073 => 0,
            33074 => 0,
            33075 => 0,
            33287 => 0,
            34389 => 0,
            34777 => 1982,
            34778 => 1724,
            34779 => 0,
            34780 => 1981,
            34782 => 1980,
            34785 => 1764,
            34787 => 1764,
            34789 => 1717,
            34792 => 1813,
            34796 => 1813,
            34798 => 1764,
            34800 => 1764,
            34801 => 1780,
            34802 => 1780,
            34804 => 1730,
            34806 => 1731,
            34807 => 1731,
            34808 => 1731,
            34810 => 1753,
            34813 => 1739,
            34816 => 1737,
            34822 => 1743,
            34823 => 1998,
            34824 => 2000,
            34825 => 2227,
            34826 => 0,
            34827 => 1785,
            34828 => 1990,
            34831 => 1776,
            34834 => 1778,
            34835 => 1999,
            34836 => 0,
            34838 => 1777,
            34845 => 1739,
            34849 => 1739,
            34852 => 1780,
            34865 => 1799,
            34867 => 1781,
            34875 => 1764,
            34876 => 1739,
            34877 => 1730,
            34878 => 0,
            34880 => 0,
            34881 => 1785,
            34882 => 1739,
            34883 => 1736,
            34885 => 1720,
            34886 => 1753,
            34887 => 1813,
            34888 => 1773,
            34889 => 1779,
            34890 => 1802,
            34891 => 1817,
            34894 => 1817,
            34895 => 0,
            34896 => 1780,
            34901 => 1873,
            34913 => 1884,
            34918 => 0,
            34919 => 1869,
            34922 => 0,
            34926 => 1780,
            34928 => 1781,
            34931 => 1744,
            34932 => 1743,
            34939 => 0,
            34949 => 1719,
            34963 => 0,
            34964 => 0,
            34965 => 1721,
            34967 => 0,
            34969 => 1722,
            34972 => 0,
            34973 => 0,
            34977 => 1785,
            34980 => 0,
            34981 => 0,
            34982 => 0,
            34983 => 0,
            34985 => 0,
            34989 => 0,
            34992 => 1803,
            34993 => 1796,
            34994 => 0,
            34995 => 1804,
            34996 => 1800,
            34997 => 0,
            34998 => 0,
            35000 => 0,
            35002 => 1739,
            35003 => 1720,
            35004 => 0,
            35006 => 1830,
            35007 => 1827,
            35008 => 0,
            35010 => 1845,
            35012 => 1817,
            35013 => 1802,
            35017 => 1818,
            35019 => 2301,
            35020 => 1823,
            35022 => 1773,
            35023 => 0,
            35030 => 1825,
            35031 => 1723,
            35033 => 0,
            35037 => 1720,
            35038 => 1844,
            35039 => 0,
            35041 => 1823,
            35042 => 0,
            35050 => 1864,
            35077 => 1880,
            35091 => 1873,
            35102 => 2221,
            35111 => 0,
            35112 => 1883,
            35113 => 0,
            35117 => 1911,
            35118 => 1902,
            35120 => 1862,
            35122 => 1915,
            35126 => 1899,
            35127 => 1877,
            35128 => 1877,
            35129 => 1921,
            35132 => 0,
            35134 => 1913,
            35138 => 1865,
            35140 => 1888,
            35141 => 1888,
            35142 => 2221,
            35144 => 0,
            35145 => 0,
            35147 => 1879,
            35149 => 1879,
            35155 => 1913,
            35164 => 0,
            35167 => 0,
            35170 => 1888,
            35179 => 1889,
            35184 => 0,
            35185 => 0,
            35186 => 1883,
            35187 => 1892,
            35188 => 1892,
            35191 => 1913,
            35192 => 1918,
            35193 => 0,
            35195 => 1921,
            35197 => 1873,
            35201 => 0,
            35204 => 0,
            35205 => 0,
            35207 => 1911,
            35208 => 1863,
            35215 => 1873,
            35219 => 0,
            35221 => 1859,
            35225 => 0,
            35228 => 0,
            35232 => 0,
            35259 => 1883,
            35713 => 1739,
            35720 => 1739,
            35721 => 2210,
            35724 => 1739,
            35727 => 1739,
            35728 => 2210,
            35755 => 2210,
            35756 => 1739,
            35807 => 1739,
            36377 => 1873,
            36397 => 0,
            36999 => 1870,
            37033 => 0,
            37045 => 0,
            37211 => 0,
            37289 => 0,
            37587 => 0,
            37653 => 0,
            37658 => 0,
            37673 => 0,
            37676 => 0,
            37679 => 0,
            37680 => 0,
            37685 => 0,
            37687 => 0,
            37691 => 0,
            37693 => 0,
            37697 => 0,
            38169 => 0,
            38180 => 0,
            38181 => 0,
            38544 => 0,
            38546 => 1738,
            39818 => 0,
            39927 => 1914,
            40200 => 1873,
            40402 => 1764,
            40403 => 1764,
            40405 => 1764,
            40411 => 1724,
            40413 => 1773,
            40437 => 1780,
            40447 => 1781,
            40449 => 1739,
            40456 => 1802,
            40459 => 0,
            40476 => 1773,
            40477 => 1739,
            40480 => 0,
            40487 => 0,
            40491 => 0,
            40494 => 1707,
            40506 => 0,
            40895 => 0,
            40896 => 0,
            41241 => 0,
            41244 => 0,
            41334 => 0,
            41361 => 0,
            41413 => 0,
            41416 => 0,
            41834 => 0,
            41838 => 0,
            41841 => 0,
            41844 => 0,
            41848 => 0,
            41849 => 0,
            41868 => 0,
            41882 => 0,
            41885 => 0,
            41895 => 0,
            43668 => 0,
            44870 => 0,
            46739 => 0,
            48518 => 0,
            48527 => 0,
            48528 => 0,
            48529 => 1707,
            48530 => 1711,
            48531 => 0,
            48532 => 1718,
            48533 => 0,
            48534 => 0,
            48535 => 0,
            48536 => 0,
            48537 => 0,
            48539 => 0,
            48540 => 0,
            48551 => 1781,
            48552 => 1724,
            48553 => 1739,
            48554 => 1738,
            48580 => 0,
            49487 => 1854,
            49491 => 0,
            49492 => 0,
            49494 => 0,
            49495 => 0,
            50354 => 0,
            52531 => 0,
            52846 => 0,
            53720 => 0,
            55660 => 1724,
            55669 => 1739,
            56022 => 0,
            56023 => 0,
            58457 => 0,
            59373 => 1879,
            59374 => 1913,
            59942 => 1877,
            60082 => 0,
            60084 => 0,
            60112 => 0,
            61984 => 0,
            62889 => 0,
            62892 => 0,
            63990 => 0,
            63994 => 1880,
            64056 => 0,
            66605 => 0,
            68474 => 0,
            68982 => 0,
            68989 => 1880,
            69001 => 1864,
            69005 => 0,
            69018 => 1861,
            69030 => 0,
            69318 => 0,
            69322 => 1741,
            69656 => 0,
            69693 => 0,
            69925 => 0,
            69989 => 0,
            69997 => 0,
            70000 => 0,
            70009 => 0,
            70010 => 2152,
            70012 => 0,
            70021 => 0,
            70024 => 0,
            70030 => 0,
            70033 => 0,
            70034 => 0,
            70044 => 1781,
            70046 => 0,
            70052 => 0,
            70058 => 0,
            70059 => 0,
            70067 => 1817,
            70076 => 0,
            70231 => 0,
            70236 => 0,
            70238 => 0,
            70665 => 0,
            70667 => 0,
            70794 => 0,
            70858 => 1773,
            70864 => 1795,
            70871 => 0,
            70881 => 1739,
            70885 => 0,
            70888 => 1739,
            70900 => 1773,
            70903 => 1773,
            70906 => 1753,
            70910 => 0,
            71158 => 0,
            71165 => 0,
            71166 => 0,
            71220 => 0,
            71268 => 0,
            71316 => 0,
            71318 => 0,
            71662 => 0,
            71677 => 1914,
            71678 => 0,
            71700 => 0,
            71707 => 0,
            71708 => 0,
            71709 => 0,
            71717 => 0,
            72187 => 0,
            72244 => 0,
            72392 => 2250,
            72393 => 0,
            72395 => 1739,
            72396 => 0,
            72397 => 0,
            72398 => 2152,
            72399 => 0,
            72400 => 1811,
            72401 => 0,
            72403 => 0,
            72405 => 0,
            72406 => 1753,
            72407 => 0,
            72408 => 2250,
            72409 => 0,
            72410 => 0,
            72411 => 1813,
            72412 => 0,
            72413 => 0,
            72414 => 0,
            72415 => 0,
            72416 => 0,
            72417 => 0,
            72418 => 0,
            72420 => 0,
            72539 => 1743,
            72540 => 1741,
            72737 => 1888,
            72840 => 0,
            72842 => 2249,
            72843 => 0,
            72844 => 1773,
            72873 => 1739,
            72875 => 0,
            72876 => 0,
            72877 => 1913,
            72878 => 0,
            72879 => 0,
            72880 => 0,
            72881 => 1914,
            72882 => 0,
            72883 => 0,
            72884 => 1764,
            72885 => 1781,
            72888 => 0,
            72891 => 0,
            72893 => 0,
            72894 => 0,
            72895 => 0,
            72896 => 0,
            72897 => 0,
            72898 => 0,
            72900 => 0,
            72901 => 0,
            72902 => 0,
            72903 => 0,
            72905 => 1720,
            72906 => 0,
            72907 => 1788,
            72909 => 1951,
            72910 => 1956,
            72913 => 1781,
            72920 => 1780,
            72921 => 0,
            72923 => 0,
            72925 => 0,
            72927 => 1731,
            72928 => 0,
            72930 => 0,
            72931 => 1780,
            72932 => 0,
            72935 => 0,
            72937 => 0,
            72939 => 0,
            72940 => 1812,
            72941 => 1745,
            72944 => 0,
            72945 => 0,
            72946 => 0,
            72947 => 0,
            72948 => 1813,
            72949 => 0,
            72950 => 0,
            72953 => 0,
            72954 => 0,
            72955 => 0,
            72957 => 0,
            72959 => 0,
            72960 => 0,
            72961 => 0,
            72962 => 0,
            72964 => 1740,
            72965 => 1741,
            72967 => 0,
            72968 => 0,
            72969 => 0,
            72971 => 0,
            72972 => 0,
            72973 => 0,
            72974 => 0,
            72975 => 1745,
            72976 => 0,
            72977 => 1854,
            72978 => 0,
            72979 => 0,
            72980 => 0,
            72981 => 0,
            72983 => 0,
            72985 => 0,
            72987 => 0,
            72991 => 1913,
            72993 => 0,
            72994 => 0,
            72996 => 0,
            72997 => 1911,
            73002 => 0,
            73003 => 1909,
            73005 => 0,
            73006 => 0,
            73007 => 0,
            73009 => 0,
            73013 => 0,
            73014 => 0,
            73022 => 0,
            73024 => 0,
            73025 => 0,
            73026 => 0,
            73028 => 0,
            73029 => 0,
            73030 => 0,
            73031 => 0,
            73032 => 0,
            73033 => 0,
            73044 => 0,
            73045 => 0,
            73046 => 0,
            73047 => 0,
            73048 => 0,
            73049 => 0,
            73050 => 0,
            73051 => 0,
            73052 => 0,
            73053 => 0,
            73054 => 0,
            73056 => 0,
            73061 => 0,
            73063 => 0,
            73067 => 1906,
            73068 => 0,
            73069 => 0,
            73071 => 0,
            73075 => 0,
            73076 => 0,
            73077 => 0,
            73078 => 0,
            73079 => 0,
            73080 => 0,
            73081 => 0,
            73082 => 0,
            73083 => 0,
            73105 => 0,
            73118 => 0,
            73123 => 0,
            73125 => 0,
            73127 => 0,
            73262 => 0,
            73329 => 0,
        );
        
        if (isset($categories[$id])) {
            return $categories[$id];
        } else {
            return 0;
        }
    }
}